/*
 * @Author:Iyoole
 * @Time  :2018-01-29
 * @Description:表格
 * @git:
 * */

;!function(e) {
    "use strict";
    var i,r={
        index:0
    };
    var Table=function(elem){
        this.elem=i(elem);
        r.index++;
    };
    Table.pt=Table.prototype;
    Table.pt.config={};
    Table.pt.dot=function(d,k){
        var t=this,m=t.config.map[k];
        if(!m) return d[k];
        var nm=m.split('.'),nd=d;
        for(var x in nm){
            try{
                nd=nd[nm[x]]
            }catch (e){
                nd=''
            }
        }
        return nd||''
    };
    Table.pt.render=function(opts){
        var t=this;
        var od={
            limit:10,//默认行数
            align:'left',//默认表格里面对齐方式
            cellWidth:60,//默认最小宽度
            noText:'',//默认无数据显示
            code:true,//默认显示数字
            fixedNum:1,//默认固定列数
            map:{}//映射表
        };
        t.cache={};
        t.config=i.extend({},od,opts);
        t.config.index=r.index;
        t.config.fixedCols=[];
        t.config.checkbox?t.cache.checked=[]:'';
        if(t.config.fixed){
            t.config.fixedNum=Math.floor(t.config.fixedNum)>1?Math.floor(t.config.fixedNum)>t.config.cols.length?1:Math.floor(t.config.fixedNum):1;
            if(t.config.code){
                if(t.config.fixedNum>1){
                    t.config.fixedCols=t.config.cols.slice(0,t.config.fixedNum-1);
                    t.config.cols=t.config.cols.slice(t.config.fixedNum-1)
                }
            }else{
                t.config.fixedCols=t.config.cols.slice(0,t.config.fixedNum);
                t.config.cols=t.config.cols.slice(t.config.fixedNum)
            }
        }
        t.setArea();//分配计算
        t.create();//创建结构
        t.isTest();
        t.events();
        return t;
    };
    Table.pt.isTest=function(){
        var t=this;
        if(t.config.staticData){//模拟数据
            if(t.config.staticData.total){
                if(t.config.staticData.total>t.config.limit){
                    t.pageShow(t.config.staticData.total);
                    t.renderData(t.config.staticData.records,1);
                }else{
                    t.renderData(t.config.staticData.records,1)
                }
            }else{
                t.renderData(t.config.staticData.records,1);
            }
        }else{
            t.pullData();//请求数据
        }
    };
    Table.pt.setArea=function(){
        var t=this,td=t.config,countWidth=0;
        var pw=td.width||function(){
                var getWidth=function(parent){
                    var width,isNone;
                    parent=parent||t.elem;
                    width=parent.width();
                    try{
                        isNone=parent.css('display')==='none'
                    }catch (e){}
                    if(parent[0]&&(!width||isNone)) return getWidth(parent.parent());
                    return width
                };
                return getWidth()
            }();
        if(td.noRightBorder){
            pw-=1
        }else{
            pw=pw-td.cols.length-1;
        }
        t.config.fixedWidth=td.fixedCols.length;
        i.each(td.fixedCols,function(m,n){//固定列宽度要是没有定义取最小宽度值,不做自适应
            n.width=n.width?n.width:td.cellWidth;
            t.config.fixedWidth+=n.width
        });
        if(td.fixed&&td.code){
            t.config.fixedWidth+=td.checkbox?86:61
        }else{
            pw=td.code?(td.checkbox?pw-86:pw-61):pw;
        }
        t.config.autoArr=[];
        t.cache.cols={};
        i.each(td.cols,function(m,n){//当里面存在未分配宽度时,多于宽度给没分配的,否则平分剩下的宽度
            t.cache.cols[n['field']]={field:n['field'],title:n['title']?n['title']:n['field']};
            if(!n.width){
                t.config.autoArr.push(m)
            }else{
                countWidth+=n.width
            }
        });
        pw=pw-t.config.fixedWidth;
        if(t.config.autoArr.length>0){
            if(pw>countWidth){
                t.config.boxWidth=countWidth;
                if(t.config.autoArr.length==1){
                    var pcw=(pw-countWidth)>t.config.cellWidth?(pw-countWidth):t.config.cellWidth;
                    t.config.boxWidth=countWidth+pcw;
                    td.cols[t.config.autoArr[0]]['width']=pcw;
                    t.config.adjustName=td.cols[t.config.autoArr[0]]['field'];//记录是哪一个
                }else{
                    i.each(t.config.autoArr,function(m,n){
                        var cw=0,scrollWidth=20;
                        if(m==0){//第一个给固定值+偏移值
                            t.config.adjustName=td.cols[n]['field'];//记录是哪一个
                            cw=t.config.cellWidth+scrollWidth;
                        }else{
                            cw=(pw-countWidth-t.config.cellWidth-scrollWidth)/(t.config.autoArr.length-1)>t.config.cellWidth?(pw-countWidth-t.config.cellWidth-scrollWidth)/(t.config.autoArr.length-1):t.config.cellWidth;
                        }
                        t.config.boxWidth+=cw;
                        td.cols[n]['width']=cw;
                    })
                }
            }else{
                t.config.boxWidth=countWidth+t.config.autoArr.length*60;
                i.each(t.config.autoArr,function(m,n){
                    td.cols[n]['width']=t.config.cellWidth
                })
            }
        }else{
            if(pw>countWidth){
                t.config.boxWidth=pw;
                var ls=td.cols[td.cols.length-1];
                ls['width']+=pw-countWidth;
                t.config.adjustName=ls['field'];
            }else{
                t.config.boxWidth=countWidth;
            }
        }
        if(!td.noRightBorder){
            t.config.boxWidth+=t.config.cols.length;
        }
        if(td.code&&!td.fixed){
            t.config.boxWidth+=td.checkbox?86:61
        }
    };
    Table.pt.create=function(){//创建框架结构
        var t=this,td=t.config,$Fixed,$Box,$FixedHeader,$FixedBody,$MainHeader,$MainBody;
        t.elem.empty();
        var $view=i('<div/>').addClass('fui-table-view').appendTo(t.elem);
        if(td.fixed){
            if(td.fixed!='left'&&td.fixed!='right') return console.error('fixed值为"left"或"right"');
            $Fixed=i('<div/>').addClass('fui-table-fixed fui-table-fixed-'+td.fixed).appendTo($view);
            $Box=i('<div/>').addClass('fui-table-box fui-'+t.config.index+'-box').appendTo($view);
            $FixedHeader=i('<div/>').addClass('fui-table-header').appendTo($Fixed);
            $FixedBody=i('<div/>').addClass('fui-table-body').append('<div class="fui-table fui-'+t.config.index+'-table"></div>').appendTo($Fixed);
        }else{
            $Box=i('<div/>').addClass('fui-table-box fui-'+t.config.index+'-box').appendTo($view);
        }
        $MainHeader=i('<div/>').addClass('fui-table-header').appendTo($Box);
        $MainBody=i('<div/>').addClass('fui-table-body').append('<div class="fui-table fui-'+t.config.index+'-table"></div>').appendTo($Box);
        var fixedTr='<div class="fui-table fui-'+t.config.index+'-table"><div class="fui-table-tr">'+function(){
                var fc=td.checkbox?'<div class="fui-table-cell fui-table-checkbox fui-table-checkAll" data-checkbox="'+t.config.index+'"><input type="checkbox">全选</div>':'<div class="fui-table-cell fui-table-code">序号</div>';
                var th=td.code?('<div class="fui-table-th">'+fc+'</div>'):'';
                i.each(td.fixedCols,function(m,n){
                    var align=n.align?n.align:t.config.align,dSort=n.sort?'data-sort="'+n.field+'"':'',fText=n.title?n.title:n.field;
                    var con=n.filter?fText+'<a href="javascript:;" class="fui-filter-sort" title="数据过滤"><i class="fui-font fui-font-filter"></i></a>':fText;
                    th+='<div class="fui-table-th" data-field="'+n.field+'"><div class="fui-table-cell fuiTable-cell-'+t.config.index+'-'+n.field+' fui-table-align-'+align+'" '+dSort+'>'+con+'</div></div>'
                });
                return th
            }()+'</div></div>';
        var tr='<div class="fui-table fui-'+t.config.index+'-table"><div class="fui-table-tr">'+function(){
                var th='';
                if(!td.fixed){
                    var fc=td.checkbox?'<div class="fui-table-cell fui-table-checkbox fui-table-checkAll" data-checkbox="'+t.config.index+'"><input type="checkbox">全选</div>':'<div class="fui-table-cell fui-table-code">序号</div>';
                    th=td.code?('<div class="fui-table-th">'+fc+'</div>'):'';
                }
                i.each(td.cols,function(m,n){
                    var align=n.align?n.align:t.config.align,dSort=n.sort?'data-sort="'+n.field+'"':'',fText=n.title!=null?n.title:n.field;
                    var con=n.filter?fText+'<a href="javascript:;" class="fui-filter-sort" title="数据过滤"><i class="fui-font fui-font-filter"></i></a>':fText;
                    th+='<div data-field="'+n.field+'" class="fui-table-th"><div class="fui-table-cell fuiTable-cell-'+t.config.index+'-'+n.field+' fui-table-align-'+align+'" '+dSort+'>'+con+'</div></div>'
                });
                return th
            }()+'</div></div>';
        $FixedHeader?$FixedHeader.append(fixedTr):'';
        $MainHeader.append(tr);
        t.$FixedBody=$FixedBody;
        t.$MainBody=$MainBody;
        t.$MainHeader=$MainHeader;
        var style="<style>"+function(){
                var sCss='';
                i.each(td.fixedCols,function(m,n){
                    sCss+='.fuiTable-cell-'+t.config.index+'-'+n.field+'{width:'+n.width+'px}'
                });
                i.each(td.cols,function(m,n){
                    sCss+='.fuiTable-cell-'+t.config.index+'-'+n.field+'{width:'+n.width+'px}'
                });
                if(td.fixed){
                    sCss+='.fui-'+t.config.index+'-box{margin-left:'+t.config.fixedWidth+'px}'
                }
                sCss+='.fui-'+t.config.index+'-box .fui-'+t.config.index+'-table{width:'+t.config.boxWidth+'px}';
                return sCss
            }()+"</style>";
        $view.append(style);
    };
    Table.pt.pullData=function(page){//请求数据
        var t=this,od={page:1||page};
        i.ajax({
            type:t.config.method||'get',
            url:t.config.url,
            dataType:'json',
            data:i.extend(true,{},od,t.config.data),
            success:function(res){
                if(res.code==1){
                    var records=res.result['records']?res.result['records']:res.result;
                    var total=res.result.total?res.result.total:records.length;
                    if(total>t.config.limit&&page==1){
                        t.pageShow(total)
                    }
                    t.renderData(records,page?page:1);
                }else{
                    layer?layer.msg('返回数据异常!'):console.error('返回数据异常!');
                }
            },
            error:function(){
                layer?layer.msg('请求失败!'):console.error('请求失败!');
            }
        });
    };
    Table.pt.renderData=function(rd,page){//数据格式处理
        var t=this,td=t.config,fixTr='',tr='';
        t.cache.data=rd;
        t.cache.checked?t.cache.checked=[]:'';
        i.each(rd,function(x,y){
            var np=(page-1)*td.limit+x+1;
            if(td.fixed){
                fixTr+='<div class="fui-table-tr">'+function(){
                        var cb=td.checkbox?'<div class="fui-table-cell fui-table-checkbox" data-checkbox="'+t.config.index+'"><input type="checkbox">'+np+'</div>':'<div class="fui-table-cell fui-table-code">'+np+'</div>';
                        var iTd=td.code?'<div class="fui-table-td">'+cb+'</div>':'';
                        i.each(td.fixedCols,function(m,n){
                            var nV=t.dot(y,n.field);
                            if(n.fun){nV=n.fun(nV)}
                            var dataClass=n.className?'fui-td-'+n.className:"";
                            var align=n.align?n.align:"left";
                            iTd+='<div class="fui-table-td '+dataClass+'"><div class="fui-table-cell fuiTable-cell-'+t.config.index+'-'+n.field+' fui-table-align-'+align+'">'+(nV?nV:td.noText)+'</div></div>'
                        });
                        return iTd
                    }()+'</div>';
                t.$FixedBody.find('.fui-table').empty().append(fixTr)
            }
            var oClick=t.config.event?'onclick="'+t.config.event+'(this,'+x+')"':'';
            tr+='<div class="fui-table-tr" '+oClick+'>'+function(){
                    var iTd='';
                    if(!td.fixed){
                        var cb=td.checkbox?'<div class="fui-table-cell fui-table-checkbox" data-checkbox="'+t.config.index+'"><input type="checkbox">'+np+'</div>':'<div class="fui-table-cell fui-table-code">'+np+'</div>';
                        iTd=td.code?'<div class="fui-table-td">'+cb+'</div>':'';
                    }
                    i.each(t.config.cols,function(m,n){
                        var nV=t.dot(y,n.field);
                        if(n.fun){nV=n.fun(nV,x)}
                        var dataClass=n.className?'fui-td-'+n.className:"";
                        var align=n.align?n.align:"left";
                        iTd+='<div class="fui-table-td '+dataClass+'"><div class="fui-table-cell fuiTable-cell-'+t.config.index+'-'+n.field+' fui-table-align-'+align+'">'+(nV?nV:td.noText)+'</div></div>'
                    });
                    return iTd
                }()+'</div>';
            t.$MainBody.find('.fui-table').empty().append(tr);
        });
        t.setHeight();
        t.scrollPatch();
    };
    Table.pt.setHeight=function(){
        var t=this,_wh=i(window).height(),height=t.config.height||_wh,body=t.elem.find('.fui-table-body');
        if(/^full-\d+$/.test(height)){
            height=_wh - height.split('-')[1];
        }
        if(t.page){//减去分页的
            height-=50
        }
        var hh=i('.fui-table-box .fui-table-header .fui-table-tr').outerHeight();
        height=(height - hh > 100)?(height-hh):100;
        body.css({'max-height':height})
    };
    //分页
    Table.pt.pageShow=function(total){
        var t=this;
        t.page=true;
        if(!t.elem.find('.tablePage')[0]){
            t.$page=i('<div/>').addClass('tablePage').attr({'page-max':5,'page-list':t.config.limit}).appendTo(t.elem);
        }else{
            t.$page=t.elem.find('.tablePage')
        }
        if(JsPage){
            JsPage('.tablePage').render(total,1,function(nPage){
                t.pullData(nPage)
            });
        }else{
            layer?layer.msg('请引入JsPage模块'):console.error('请引入JsPage模块')
        }
    };
    //获取cssRule
    Table.pt.getCssRule = function(field, c1,c2){
        var t = this
            ,style = t.elem.find('style')[0]
            ,sheet = style.sheet || style.styleSheet || {}
            ,rules = sheet.cssRules || sheet.rules;
        i.each(rules,function(m,n){
            if(n.selectorText===('.fuiTable-cell-'+t.config.index+'-'+field)){
                return c1(n),true;
            }
            if(c2&&n.selectorText===('.fui-'+t.config.index+'-box .fui-'+t.config.index+'-table')){
                return c2(n),true
            }
        });
    };
    //获取滚动条宽度
    Table.pt.getScrollWidth = function(elem){
        var width = 0;
        if(elem){
            width = elem.offsetWidth - elem.clientWidth;
        } else {
            elem = document.createElement('div');
            elem.style.width = '100px';
            elem.style.height = '100px';
            elem.style.overflowY = 'scroll';

            document.body.appendChild(elem);
            width = elem.offsetWidth - elem.clientWidth;
            document.body.removeChild(elem);
        }
        return width;
    };
    //滚动条补丁
    Table.pt.scrollPatch=function(){
        var t=this,
            scrollWidth=t.$MainBody.width()-t.$MainBody.prop('clientWidth'),
            scrollHeight=t.$MainBody.height()-t.$MainBody.prop('clientHeight');
        if(scrollWidth){
            if(t.config.adjustName&&!t.scrollPatchWStatus){
                t.getCssRule(t.config.adjustName,function(item){
                    var aw=parseFloat(item.style.width)-scrollWidth;
                    item.style.width=aw+'px';
                },function(tableBox){
                    var tw=parseFloat(tableBox.style.width)-scrollWidth;
                    tableBox.style.width=tw+'px'
                });
                t.scrollPatchWStatus=true;
            }
            if(!t.elem.find('.fui-table-patch')[0]){
                var patchElem=i('<div class="fui-table-patch"><div class="fui-table-cell"></div></div>');
                patchElem.find('div').css({width:scrollWidth});
                t.$MainHeader.find('.fui-table-tr').append(patchElem);
            }
            var ow=t.elem.find('.fui-table-box .fui-table-body .fui-'+t.config.index+'-table').outerWidth();
            t.elem.find('.fui-table-box .fui-table-header .fui-'+t.config.index+'-table').css({width:ow+scrollWidth+1});
        }else{
            t.elem.find('.fui-table-box .fui-table-header .fui-'+t.config.index+'-table').removeAttr('style');
            t.$MainHeader.find('.fui-table-patch').remove()
        }
        if(scrollHeight&&t.config.fixed){
            if(!t.elem.find('.fui-table-fixPatch')[0]){
                var fixPatch=i('<div class="fui-table-tr fui-table-fixPatch"><div class="fui-table-cell"></div></div>');
                fixPatch.find('div').css({height:scrollHeight});
                t.$FixedBody.find('.fui-'+t.config.index+'-table').append(fixPatch)
            }
        }else if(t.config.fixed){
            t.$FixedBody.find('.fui-table-fixPatch').remove();
        }
    };
    //事件
    Table.pt.events=function(){
        var t=this,
            ot=t.config,
            _Body=i('body'),
            dict={},
            resizing,
            th=t.$MainHeader.find('.fui-table-th');
        th.on('mousemove',function(e){
            var _t=i(this),
                _oLeft=_t.offset().left,
                _pLeft=e.clientX - _oLeft;
            dict.allowResize=_t.width() - _pLeft<=10;
            _Body.css('cursor',(dict.allowResize?'col-resize':''));
        }).on('mouseleave',function(){
            if(dict.resizeStart) return;
            _Body.css('cursor','')
        }).on('mousedown',function(e){
            var _t=i(this);
            if(dict.allowResize){
                var field=_t.data('field');
                e.preventDefault();
                dict.resizeStart=true;
                dict.offset=[e.clientX,e.clientY];
                t.getCssRule(field,function(item){
                    var width=item.style.width||_t.outerWidth();
                    dict.rule=item;
                    dict.ruleWidth=parseFloat(width);
                    dict.minWidth=_t.data('minwidth')||ot.cellWidth;
                },function(item){
                    dict.tableBox=item;
                    dict.tableBoxWidth=parseFloat(item.style.width);
                })
            }
        });
        //拖拽中
        i(document).on('mousemove',function(e){
            if(dict.resizeStart){
                e.preventDefault();
                if(dict.rule){
                    var setWidth=dict.ruleWidth + e.clientX - dict.offset[0];
                    if(setWidth<dict.minWidth) setWidth=dict.minWidth;
                    dict.rule.style.width=setWidth + 'px';
                    dict.tableBox.style.width=dict.tableBoxWidth + setWidth - dict.ruleWidth +'px';
                    t.scrollPatch();
                }
                resizing=1
            }
        }).on('mouseup',function(){
            if(dict.resizeStart){
                dict={};
                _Body.css('cursor','');
                t.scrollPatch();
            }
            if(resizing===2){
                resizing=null
            }
        });
        t.$MainBody.on('scroll',function(){
             var _t=i(this),
                 scrollLeft=_t.scrollLeft(),
                 scrollTop=_t.scrollTop();
            t.$MainHeader.scrollLeft(scrollLeft);
            t.config.fixed?t.$FixedBody.scrollTop(scrollTop):'';
        });
        //自适应
        i(window).on('resize',function(){
            t.setHeight();
            t.scrollPatch()
        });
        //hover同步事件
        t.elem.find('.fui-table-body .fui-table-tr').on('mousemove',function(){
            var _t=i(this),idx=_t.index();
            t.elem.find('.fui-table-fixed .fui-table-body .fui-table-tr').eq(idx).addClass('trHover').siblings().removeClass('trHover');
            t.elem.find('.fui-table-box .fui-table-body .fui-table-tr').eq(idx).addClass('trHover').siblings().removeClass('trHover')
        }).on('mouseleave',function(){
            t.elem.find('.trHover').removeClass('trHover')
        });
        //checkbox
        t.elem.find('.fui-table-checkbox').on('click',function(e){
            e.stopPropagation();
            var _t=i(this),checkbox=t.elem.find('.fui-table-checkbox[data-checkbox="'+t.config.index+'"]'),checked='fui-table-checked',ckAll=t.elem.find('.fui-table-checkAll[data-checkbox="'+t.config.index+'"]');
            if(_t.hasClass('fui-table-checkAll')){
                if(_t.hasClass(checked)){
                    checkbox.removeClass(checked).find('input').prop('checked',false);
                    t.cache.checked=[]
                }else{
                    checkbox.addClass(checked).find('input').prop('checked',true);
                    t.cache.checked=t.cache.data
                }
            }else{
                var idx=_t.parent('.fui-table-td').parent('.fui-table-tr').index();
                if(_t.hasClass(checked)){
                    _t.removeClass(checked).find('input').prop('checked',false);
                    ckAll.removeClass(checked).find('input').prop('checked',false);
                    t.cache.checked=fui.array.del(t.cache.data[idx],t.cache.checked)
                }else{
                    _t.addClass(checked).find('input').prop('checked',true);
                    if(checkbox.length - 1==t.elem.find('.'+checked).length){
                        ckAll.addClass(checked).find('input').prop('checked',true)
                    }
                    t.cache.checked=fui.array.join(t.cache.data[idx],t.cache.checked)
                }
            }
        });
        //filter
        t.elem.find('.fui-filter-sort').on('click',function(){
            var _t=i(this),field=_t.parents('.fui-table-th').data('field');
            var title=t.cache.cols[field]['title'];
            layer?layer.open({
                title:'数据过滤',
                content:EPS.filter.text(field,title),
                btn:['确定','取消'],
                yes:function(){
                    layer.closeAll();
                    layer.msg('功能开发中,敬请期待');
                }
            }):console.error('请引入layer插件模块');
        });
    };
    //数据重载
    Table.pt.reload=function(){
        var t=this;
        t.$MainBody=t.elem.find('.fui-table-box .fui-table-body');
        t.$FixedBody=t.elem.find('.fui-table-fixed .fui-table-body');
        t.pullData();//重拉数据
    };
    //复选框回调事件
    Table.pt.checkBack=function(c,p){
        var t=this,pj=[];
        if(p){
            p='object'===typeof p?p:[p];
            for(var j=0;j<p.length;j++){
                pj.push([])
            }
            var fp=function(n,m){
                var nd=n;
                for(var k=0;k<m.length;k++){
                    nd=nd[m[k]]
                }
                return nd||''
            };
            i.each(t.cache.checked,function(x,y){
                i.each(p,function(nx,ny){
                    pj[nx].push(fp(y,ny.split('.')))
                });
            });
        }
        c(t.cache.checked,pj)
    };
    //回调数据(单选,多选可用上面复选框回调)
    Table.pt.dataBack=function(idx,c){
        var t=this;
        if(typeof idx!='number'){
            try{
                idx=parseInt(idx)
            }catch (e){return console.error('查询回调值不正确')}
        }
        var flag='number'===typeof idx&&idx<t.config.limit;
        if(flag||idx==0){
            c(t.cache.data[idx])
        }else{
            console.error('查询回调值不正确')
        }
    };
    var JsTable=function(elem){
        return new Table(elem)
    };
    JsTable.v='1.1';
    if(window.fui && fui.define ){
        fui.define('jquery', function(exports){
            e.JsTable=JsTable;
            i=fui.$;
            exports('JsTable', JsTable);
        });
    }else{//如果直接引用的话
        e.JsTable=JsTable;
        i=e.jQuery;
    }
}(window);

/*
* 参数说明
* cols  :---->表头
*   ---field:数据中参数名--对表格后面填充数据有用(必填)
*   ---title:表头显示内容--如果不填,默认取field的值(选填)
*   ---width:宽度值---(选填)
*   ---fun  :对返回值进行处理的外接方法(选填)
*   ---align:"left"/"right"/"center"
*   ---className:"给td加的类名"
* map   :---->映射
* height:---->高度(选填)
* fixed :---->左/右固定(固定值left/right)(选填)
* fixedNum:-->固定列数(默认是1)
* url   :---->数据请求地址(必填)
* data  :---->数据请求参数(选填)
* method:---->数据请求类型(默认get)
* limit :---->每页条数(默认10)
* noText:---->如果没有数据时,默认显示内容(默认为空)(选填)
* code  :---->每行数字(默认显示)(选填)
* checkbox:-->选择框(选填)
* staticData:->静态数据
* */
/*
* 示例:
* JsTable('.demo').render({
*   height:320,
*   fixed:'left',
*   url:'../../..',
*   data:{},
*   method:'post',
*   limit:20,
*   staticData:{}
*   cols:[
*   {field:'id',title:'ID',width:80},
*   {field:'name',title:'用户',width:80},
*   {field:'sex',title:'性别',width:80},
*   ...
*   ]
* })
* */


/*
* 1.1
* 新增固定列
*
* */




